public class Originator {
    private String state;
    
    public void setState(String state) {
        this.state = state;
    }

    public String getState() {
        return state;
    }

    public Memento saveStateToMemento() {
        return new Memento(this.state);
    }

    public void getStateFrMemento(Memento memento) {
        setState(memento.getState());
    }
}
